package mysql

import (
	"Shopping/models"
	"database/sql"
	"go.uber.org/zap"
)

func GetProductList() (productList []*models.Product, err error) {
	sqlStr := "select product_id,product_name from product"
	if err = db.Select(&productList, sqlStr); err != nil {
		// 如果查询为空
		if err == sql.ErrNoRows {
			zap.L().Warn("no result from community table")
			err = nil
		}
	}
	return
}
